package com.edu.lxshpc.pojo;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import com.edu.lxshpc.povo.UserVO;
import lombok.Data;

/**
 * @TableName blog
 */
@TableName(value = "blog")
@Data
public class Blog implements Serializable {
    /**
     * 博客id
     */
    @TableId(type = IdType.ASSIGN_ID)
    private Long blogId;

    /**
     * 博客封面url
     */
    private String url;

    /**
     * 博客标题
     */
    private String title;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 博客正文
     */
    private String content;

    /**
     * 描述
     */
    private String description;

    /**
     * 分类id
     */

    private Integer categoryId;

    @TableLogic
    private Integer deleted = 0;
    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;
    /**
     * 用户信息
     */
    @TableField(exist = false)
    private UserVO user;
    /**
     * 分类信息
     */
    @TableField(exist = false)
    private BlogCategory blogCategory;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Blog blog = (Blog) o;

        if (blogId != null ? !blogId.equals(blog.blogId) : blog.blogId != null) return false;
        if (url != null ? !url.equals(blog.url) : blog.url != null) return false;
        if (title != null ? !title.equals(blog.title) : blog.title != null) return false;
        if (userId != null ? !userId.equals(blog.userId) : blog.userId != null) return false;
        if (content != null ? !content.equals(blog.content) : blog.content != null) return false;
        if (description != null ? !description.equals(blog.description) : blog.description != null) return false;
        if (categoryId != null ? !categoryId.equals(blog.categoryId) : blog.categoryId != null) return false;
        if (createTime != null ? !createTime.equals(blog.createTime) : blog.createTime != null) return false;
        return updateTime != null ? updateTime.equals(blog.updateTime) : blog.updateTime == null;
    }

    @Override
    public int hashCode() {
        int result = blogId != null ? blogId.hashCode() : 0;
        result = 31 * result + (url != null ? url.hashCode() : 0);
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (categoryId != null ? categoryId.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        return result;
    }

}